namespace Firestarter.DB.Schema.Logic
{
    public class RegexBuilderSQL : RegexBuilder<RegexBuilderSQL>
    {
        public RegexBuilderSQL BeginCreateTable(string tableName)
        {
            // @"CREATE\s+TABLE\s+" + tableName + @"\s+\(\s*"
            return Specific("CREATE").
                    WhiteSpace.OneToMany.Specific("TABLE").
                    WhiteSpace.OneToMany.Specific(tableName).
                    WhiteSpace.OneToMany.Specific("(").
                    WhiteSpace.ZeroToMany;
        }

        public RegexBuilderSQL EndCreateTable()
        {
            // @"\)\s*"
            return Specific(")").WhiteSpace.ZeroToMany;
        }

        public RegexBuilderSQL ColumnDefinition()
        {
            return AlphaNumeric.OneToMany.WhiteSpace.OneToMany
                .DataType();
        }

        public RegexBuilderSQL DataType()
        {
            return AlphaNumeric.OneToMany.Alternatives(
                null,
                Create().Specific("(").Delimited(Create().Numeric.OneToMany, ",", 1, 2).Specific(")")
                //Create().Specific("(").Numeric.OneToMany.Alternatives(
                //    null,
                //    Create().Specific(",").Numeric.OneToMany
                //    ).Specific(")")
                );
        }
    }
}
